How to handle key in PhP array if the key contains japanese characters [migrated]

Posted by Jim Thio on Programmers See other posts from Programmers or by Jim Thio
Published on 2012-06-01T05:40:56Z Indexed on 2012/06/01 10:50 UTC
Read the original article Hit count: 271

Filed under:
|

I have this array:

[ID] => ????????-???????????__35.79_139.72
[Email] => 
[InBuildingAddress] => 
[Price] => 
[Street] => 
[Title] => ???????? ???????????
[Website] => 
[Zip] => 
[Rating Star] => 0
[Rating Weight] => 0
[Latitude] => 35.7865334803033
[Longitude] => 139.716800710514
[Building] => 
[City] => Unknown_Japan
[OpeningHour] => 
[TimeStamp] => 0000-00-00 00:00:00
[CountViews] => 0

Then I do something like this:

    $output[$info['ID']]=$info; //mess up here
    $tes=$info['ID']['Title'];

Well guess what it messes up. Basically even though the content of an array in PhP can be Japanese. Is this true?

What's wrong. The error I got is:

Debug Warning: /sdfdsfdf/api/test2.php line 36 - Cannot find element ????????-???????????__35.79_139.72 in variable Debug Warning: /sdfdsfdf/api/test2.php line 36 - main() [function.main]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Krasnoyarsk' for '7.0/no DST' instead

So many question mark

Why is this happening. What's really going on inside PhP? Where can I learn more of such things. Most importantly, what would be the best way to handle this situation. Should I tell PhP to internally always use UTF-8? Does PhP array inherenty cannot use non ascii id?

© Programmers or respective owner

Related posts about php

Related posts about array